package com.dangf.hzapp.fragment;

import com.dangf.hzapp.HzApplication;
import com.dangf.hzapp.widget.CustomProgressDialog;

import android.app.Fragment;
import android.os.Bundle;

/**
 * 基本 Fragment
 * @author 韦海生
 * @date 2014年8月4日
 */
public class BaseFragment extends Fragment {
	protected HzApplication app;
	protected CustomProgressDialog dialog;
	
	@Override
	public void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		app = (HzApplication) getActivity().getApplication();
	}
	
	
	/**
	 * 显示进度条
	 */
	public void showDialog(){
		if (dialog == null){
			dialog = CustomProgressDialog.createDialog(getActivity());
		}
		dialog.show();
	}
	
	/**
	 * 隐藏进度条
	 */
	public void hideDialog(){
		dialog.hide();
		dialog.setMessage("");
	}

	/**
	 * 显示titile
	 * @param msg
	 */
	public void showDialog(String msg){
		showDialog();
		if(dialog!=null)dialog.setMessage(msg);
	}
}
